package com.example.activity;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.adapter.MainRvAdapter;
import com.example.interfacePackage.RvClickInterface;
import com.example.studyapplication.R;

import java.util.ArrayList;

/**
 * @Description: 绘制选项
 * @Author: 葛浩杰
 * @Version: 1.0 2020/12/21
 */
public class CanvasActivity extends Activity {

    private RecyclerView mRvCanvas;
    private ArrayList<String> mRvList;
    private MainRvAdapter mMainRvAdapter;

    public static void startActivity(Context context){
        Intent intent = new Intent(context,CanvasActivity.class);
        context.startActivity(intent);
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_canvas);

        initView();
        initData();
    }

    private void initView() {
        mRvCanvas = findViewById(R.id.rv_canvas);
    }

    private void initData() {
        mRvList = new ArrayList<>();
        mRvList.add("drawARGB");
        mRvList.add("drawText");
        mRvList.add("drawColor");
        mRvList.add("drawPoint");
        mRvList.add("drawOval");
        mRvList.add("drawLine");
        mRvList.add("drawCircle");
        mRvList.add("drawBitmap");
        mRvList.add("drawArc");
        mRvList.add("drawRoundRect");
        mRvList.add("drawPath");
        mRvList.add("drawPath一阶贝塞尔");
        mRvList.add("drawPath二阶贝塞尔");
        mRvList.add("drawPath三阶贝塞尔");
        mRvList.add("综合");

        mRvCanvas.setLayoutManager(new LinearLayoutManager(this));
        mMainRvAdapter = new MainRvAdapter(this, mRvList);
        mRvCanvas.setAdapter(mMainRvAdapter);
        mMainRvAdapter.setOnItemClickListener(new RvClickInterface() {
            @Override
            public void OnItemClickListener(int position) {
                DrawActvity.startActivity(CanvasActivity.this, position);
            }
        });
    }
}
